package com.dashen.sso.third.party.Controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;

/**
 * @author Barry Wang
 */
@Controller
@RequestMapping("test/")
public class TestController {

    @RequestMapping("host")
    @ResponseBody
    public HashMap<String,String> home(HttpServletRequest request){

        String path = request.getContextPath();
        String name =request.getServerName();
        int port = request.getServerPort();

        HashMap<String,String> map = new HashMap<String,String>();
        map.put("name", name);
        map.put("port", String.valueOf(port));
        map.put("context", path);

        return map;
    }
}
